home *** CD-ROM | disk | FTP | other *** search
/ Multimedia Jumpstart / Multimedia Microsoft Jumpstart Version 1.1a (Microsoft).BIN / develpmt / drivers / mscdex / hitachi / tracer.asm < prev   
Encoding:
Assembly Source File  |  1990-10-15  |  1.8 KB  |  95 lines

  1. page    ,132
  2. ;-----------------------------Module-Header-----------------------------;
  3. ; Module Name:  TRACER.ASM
  4. ;
  5. ;   This module contains debugging functions.
  6. ;
  7. ; Created: 13-Feb-1989
  8. ; Author:  Gary Maltzen
  9. ;
  10. ; Copyright (c) 1989  Preferred Solutions, Inc.
  11. ; Copyright (c) 1989  Video Seven Inc.
  12. ;
  13. ; Exported Functions:   none
  14. ;
  15. ; Public Functions:     tracer
  16. ;
  17. ; Public Data:
  18. ;
  19. ; General Description:
  20. ;
  21. ; Restrictions:
  22. ;
  23. ;-----------------------------------------------------------------------;
  24. ?WIN=0
  25.         .xlist
  26.         include cmacros.inc
  27.         .list
  28.  
  29. sBegin  Code
  30. assumes cs,Code
  31.  
  32. ;=======================================================================
  33. ;
  34. ;  calling sequence - NOTE CAREFULLY
  35. ;
  36. ;       call    far ptr tracer
  37. ;       jmp     short @f
  38. ;       db      'text....'
  39. ; @@:   ...
  40. ;
  41. ;  the jump distance in the `jmp short' instruction
  42. ;  incidentally happens to be the string length
  43. ;  THIS ROUTINE DEPENDS ON THIS!
  44.  
  45.  
  46.         public  tracer
  47. tracer  proc    far
  48.  
  49.  IF 1
  50.         push    bp
  51.         mov     bp,sp
  52.  
  53.         pushf
  54.         push    si
  55.         push    ds
  56.         push    dx
  57.         push    cx
  58.         push    bx
  59.         push    ax
  60.  
  61.         cld
  62.         lds     si,[bp+2]       ;get return address
  63.         lodsb                   ;`jmp short' opcode
  64.         lodsb                   ;string length
  65.         mov     cl,al
  66.         xor     ch,ch
  67.         jcxz    short @2
  68.  
  69.         xor     dx,dx           ;COM1
  70. @1:     lodsb                   ;next byte
  71.         mov     ah,01h          ;write byte
  72.         int     14h
  73.         loop    @1      
  74.  
  75. @2:     pop     ax
  76.         pop     bx
  77.         pop     cx
  78.         pop     dx
  79.         pop     ds
  80.         pop     si
  81.         popf
  82.  
  83.         pop     bp
  84.  
  85.  ENDIF
  86.  
  87.         ret
  88.  
  89. tracer  endp
  90.  
  91.  
  92. sEnd    Code
  93.  
  94. end
  95.